<style scoped>

</style>

<template>
    <div class="dateTwo">
      <myDatePickerTwo @dateClick="dateClick" @dateBack="dateBack"  :start="start" :end="end" :max="maxProp" :toastInfoArr="toastInfoArr"></myDatePickerTwo>
    </div>
</template>

<script>
  import myDatePickerTwo from './myDatePickerTwo.vue';
   export default{
     data(){
       return{
         back:'',
         toastInfoArr:['选择入住日期','选择离店日期']
       }
     },
     mounted(){

       this.back = this.$route.params.back;

     },
     methods:{
       dateBack(){
         this.$router.go(-1);
       },
       dateClick(msg){
         this.$store.state.hotel.ruzhuTime = msg.startTime;
         this.$store.state.hotel.lidianTime = msg.endTime;
         this.$store.state.hotel.ruzhuYear = moment(msg.startTime).format('YYYY');
         this.$store.state.hotel.ruzhuMonth = moment(msg.startTime).format('MM');
         this.$store.state.hotel.ruzhuDay = moment(msg.startTime).format('DD');

         this.$store.state.hotel.lidianYear = moment(msg.endTime).format('YYYY');
         this.$store.state.hotel.lidianMonth = moment(msg.endTime).format('MM');
         this.$store.state.hotel.lidianDay = moment(msg.endTime).format('DD');
         this.$router.go(-1);
         this.$router.replace({
           name:this.back,
           params:{
             date:msg,
             dateBack:true
           }
         })

       },
     },
     computed:{
       start(){
         return this.$store.state.hotel.ruzhuTime
       },
       end(){
         return this.$store.state.hotel.lidianTime
       },
       maxProp(){
         var k = '364'.future();
         return k ;
       },
     },
     watch:{},
     components:{myDatePickerTwo},
   }
</script>
